Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add support for poll watcher #21290

Merged
merged 23 commits into from
Nov 11, 2024

Conversation

amribm
Copy link
Contributor

@amribm amribm commented Sep 13, 2024

Closes #21111

@amribm amribm requested a review from a team as a code owner September 13, 2024 04:59
@bits-bot
Copy link

bits-bot commented Sep 13, 2024

CLA assistant check
All committers have signed the CLA.

@amribm amribm force-pushed the feature/support_for_poll_watcher branch from 3773b14 to ae66312 Compare September 13, 2024 05:01
@amribm amribm force-pushed the feature/support_for_poll_watcher branch from 4c926d0 to 1802ece Compare September 13, 2024 05:17
@amribm amribm changed the title feat(watcher): add support for poll watcher support feat(watcher): add support for poll watcher Sep 13, 2024
src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/config/watcher.rs Outdated Show resolved Hide resolved
src/config/watcher.rs Outdated Show resolved Hide resolved
src/config/watcher.rs Show resolved Hide resolved
src/config/watcher.rs Show resolved Hide resolved
src/config/watcher.rs Outdated Show resolved Hide resolved
src/config/watcher.rs Outdated Show resolved Hide resolved
src/config/watcher.rs Outdated Show resolved Hide resolved
src/config/watcher.rs Outdated Show resolved Hide resolved
src/config/watcher.rs Outdated Show resolved Hide resolved
@pront pront self-requested a review September 25, 2024 22:24
@pront
Copy link
Contributor

pront commented Sep 26, 2024

Hey @amribm, thank you for this PR!

@amribm
Copy link
Contributor Author

amribm commented Sep 26, 2024

okay, i will add changelog

  • I see there are a couple of open comment threads, is this ready for a review?

Yes This is ready for review , @pront i need some confirmation from vector team for those comments. that's why i didn't resolved them.

src/cli.rs Outdated Show resolved Hide resolved
src/cli.rs Outdated Show resolved Hide resolved
src/cli.rs Show resolved Hide resolved
src/config/watcher.rs Outdated Show resolved Hide resolved
src/config/watcher.rs Show resolved Hide resolved
amribm and others added 3 commits September 28, 2024 10:59
Co-authored-by: Pavlos Rontidis <[email protected]>
Co-authored-by: Pavlos Rontidis <[email protected]>
Co-authored-by: Pavlos Rontidis <[email protected]>
src/config/watcher.rs Outdated Show resolved Hide resolved
@amribm amribm requested review from a team as code owners October 1, 2024 15:34
@github-actions github-actions bot added the domain: external docs Anything related to Vector's external, public documentation label Oct 1, 2024
Copy link
Contributor

@pront pront left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment (TIOLI). Also, waiting for a documentation review. Otherwise, this is good to go 🚀

@@ -19,11 +22,49 @@ const CONFIG_WATCH_DELAY: std::time::Duration = std::time::Duration::from_secs(1

const RETRY_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(10);

/// Refer to [`crate::cli::WatchConfigMethod`] for details.
pub enum WatcherConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can refactor create_watcher to use the WatchConfigMethod enum directly. AFAIK, due to clap parsing, the WatchConfigMethod needs to have plain enum variants.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since i want that enum to have values about the interval and i don't want to pass the interval in the function parameters.

One thing we can do is we can eliminate is watch config method enum. we can make it as string and add the possible values for clap arguments. using that we can create the WatcherConfig enum

}

fn watch(&mut self, path: &Path, recursive_mode: RecursiveMode) -> Result<(), Error> {
use notify::Watcher as NotifyWatcher;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: any reason to use this here vs at the top like the other imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we already have name watcher as enum. it was colliding with watcher from notify.
Renaming the import at the top level user might not able to understand what is NotifyWathcher and we need the methods for notify::Watcher on that specific scope. that's why i used Watcher on the specific scope

@pront pront changed the title feat(watcher): add support for poll watcher feat(cli): add support for poll watcher Oct 22, 2024
@pront
Copy link
Contributor

pront commented Oct 22, 2024

I think we addressed all open questions here? cc @amribm and @jorgehermo9
If so, I will go ahead and merge this one. Let me know if you need any further input from me.

@jorgehermo9
Copy link
Contributor

LGTM!

@pront pront enabled auto-merge October 22, 2024 19:06
auto-merge was automatically disabled October 23, 2024 10:51

Head branch was pushed to by a user without write access

@pront pront enabled auto-merge October 23, 2024 19:42
auto-merge was automatically disabled October 25, 2024 09:00

Head branch was pushed to by a user without write access

@pront pront enabled auto-merge November 6, 2024 18:55
@pront
Copy link
Contributor

pront commented Nov 6, 2024

Apologies, I didn't realize this got pushed out of the merge queue.

@amribm
Copy link
Contributor Author

amribm commented Nov 11, 2024

When this PR will merge @pront?

Signed-off-by: Jesse Szwedko <[email protected]>
@jszwedko
Copy link
Member

When this PR will merge @pront?

It looks like there were cue formatting issues blocking merge as the failed CI check shows. I formatted and pushed though so I think this should merge soon if there are no other failing checks.

@pront pront added this pull request to the merge queue Nov 11, 2024
Merged via the queue into vectordotdev:master with commit b3c8dc8 Nov 11, 2024
40 checks passed
@pront
Copy link
Contributor

pront commented Nov 11, 2024

Thanks again, this is a great contribution 🚀

@amribm
Copy link
Contributor Author

amribm commented Nov 12, 2024

Thank you guys, this is my first open-source contribution. thanks for making this possible. @jorgehermo9 @pront @brittonhayes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: external docs Anything related to Vector's external, public documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Polling based extension of the —watch-config flag that doesn’t rely on inotify/SIGHUP
7 participants